package com.flex.entity;

import com.mybatisflex.annotation.*;
import com.mybatisflex.core.keygen.KeyGenerators;
import com.mybatisflex.core.mask.Masks;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.cglib.core.KeyFactory;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 账户实体类。
 *
 * @author 125715
 * @since 2024-03-04
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "tb_account")
public class Account {

    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId)
    private String accountId;

    private String userName;

    @ColumnMask(Masks.PASSWORD)
    private String password;

    @ColumnMask(Masks.FIXED_PHONE)
    private String phone;

    @ColumnMask(Masks.EMAIL)
    private String email;

    private Integer age;

    private Date birthday;

    @Column(onInsertValue = "0",version = true)
    private Integer version;

    @Column(onInsertValue = "now()")
    private Date createTime;

    @Column(onInsertValue = "now()",onUpdateValue = "now()")
    private Date updateTime;

    @Column(isLogicDelete = true,onInsertValue = "0")
    private Integer isDelete;

}
